from django.db import models

# Create your models here.
class User(models.Model):
    """用户"""
    no = models.AutoField(primary_key=True, verbose_name='编号')
    username = models.CharField(max_length=20, unique=True, verbose_name='用户名')
    password = models.CharField(max_length=32, verbose_name='用户密码')
    tel = models.CharField(max_length=20, default='', verbose_name='手机号')
    regdate = models.DateTimeField(auto_now_add=True, verbose_name='注册日期')
    yinchang = models.IntegerField(max_length=20, default=0, verbose_name='隐藏')

    class Meta:
        db_table = 'tb_user'


class Goods(models.Model):
    """
    Goods发布的图片
    """
    c_image = models.ImageField(upload_to='goods/images/', null=True, blank=True, verbose_name='封面图')

    class Meta:
        managed = False
        db_table = 'f_goods'


class C_f(models.Model):
    """
    C_f 朋友圈
    """
    image_name = models.CharField(max_length=2048, verbose_name='朋友圈')
    user_id = models.ForeignKey(User,related_name="pengyou", on_delete=models.CASCADE)
    fdate = models.DateTimeField(auto_now_add=True, verbose_name='发表日期')
    yinchang = models.IntegerField(max_length=20, default=0, verbose_name='隐藏')
    class Meta:
        db_table = 'c_f'